// class used for testing...
function SimpleObject( simpleValue ) {
	this.simpleValue = simpleValue;
}


function ExpectEqualTest() {

	ExpectEqualTest.prototype = new TestCase();
	TestCase.call( this, 'ExpectEqualTest' );
	
	this.test_evaluateReturnsTrueIfExpectedAndActualAreMatchingStrings = function() {
		var expect = new ExpectEqual( 'thisStringMatches', 'thisStringMatches' );
		this.assertTrue( expect.evaluate() );
	
		expect = new ExpectEqual( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' );
		this.assertTrue( expect.evaluate() );
	
		expect = new ExpectEqual( 'this\r\n\r\nStringMatches', 'this\r\n\r\nStringMatches' );
		this.assertTrue( expect.evaluate() );
	}
	
	this.test_evaluateReturnsFalseIfExpectedAndActualAreStringsThatDoNotMatch = function() {
		var expect = new ExpectEqual( 'thisStringDoesNotMatches', 'thisStringMatchesNot' );
		this.assertTrue( ! expect.evaluate() );
	
		expect = new ExpectEqual( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' );
		this.assertTrue( ! expect.evaluate() );
	
		expect = new ExpectEqual( 'UPPERCASE', 'uppercase' );
		this.assertTrue( ! expect.evaluate() );
	}
	
	this.test_evaluateReturnsTrueIfExpectedAndActualAreMatchingIntegers = function() {
	
		var expect = new ExpectEqual( 1, 1 );
		this.assertTrue( expect.evaluate() );
	
		expect = new ExpectEqual( -1, -1 );
		this.assertTrue( expect.evaluate() );
	
		expect = new ExpectEqual( 0, 0 );
		this.assertTrue( expect.evaluate() );
	
		expect = new ExpectEqual( 2^64, 2^64 );
		this.assertTrue( expect.evaluate() );
	
		expect = new ExpectEqual( (2^64) * -1 , (2^64) * -1 );
		this.assertTrue( expect.evaluate() );
	}
	
	this.test_evaluateReturnsTrueIfExpectedAndActualAreMatchingFloats = function() {
	
		var expect = new ExpectEqual( 0.0001, 0.0001 );
		this.assertTrue( expect.evaluate() );
	
		var expect = new ExpectEqual( -0.0001, -0.0001 );
		this.assertTrue( expect.evaluate() );
	
		var expect = new ExpectEqual( 1000000000.0001, 1000000000.0001 );
		this.assertTrue( expect.evaluate() );
	
	}
	
	this.test_evaluateReturnsTrueIfExpectedAndActualAreReferencesToTheSameObject = function() {
	
		var simpleObject = new SimpleObject( 1 );
		var expect = new ExpectEqual( simpleObject, simpleObject );
		this.assertTrue( expect.evaluate() );
	
	}
	
	this.test_evaluateReturnsTrueIfExpectedAndActualAreEqualObjectsWhilstNotbeingReferencesToTheSameObject = function() {
	
		var simpleObject  = new SimpleObject( 1 );
		var simpleObject2 = new SimpleObject( 1 );
		
		var expect = new ExpectEqual( simpleObject, simpleObject2 );
		this.assertTrue( expect.evaluate() );
	
	}
	
	this.test_evaluateReturnsFalseIfExpectedAndActualAreSimilarButDifferInType = function() {
	
		var expect = new ExpectEqual( 1, '1' );
		this.assertTrue( ! expect.evaluate(), 'char to number' );
	
		var expect = new ExpectEqual( '1', 1 );
		this.assertTrue( ! expect.evaluate(), 'number to char' );
	
		var expect = new ExpectEqual( true, 1 );
		this.assertTrue( ! expect.evaluate(), 'bool to number' );
	
		var expect = new ExpectEqual( 1, true );
		this.assertTrue( ! expect.evaluate(), 'number to bool' );
	
		var expect = new ExpectEqual( false, 0 );
		this.assertTrue( ! expect.evaluate(), 'bool to number' );
	
		var expect = new ExpectEqual( 0, false );
		this.assertTrue( ! expect.evaluate(), 'number to bool' );
	
		var expect = new ExpectEqual( false, '' );
		this.assertTrue( ! expect.evaluate(), 'bool to char' );
	
		var expect = new ExpectEqual( '', false );
		this.assertTrue( ! expect.evaluate(), 'char to bool' );
	
		var expect = new ExpectEqual( null, 0 );
		this.assertTrue( ! expect.evaluate(), 'null to number' );
	
		var expect = new ExpectEqual( 0, null );
		this.assertTrue( ! expect.evaluate(), 'number to null' );
	
		var expect = new ExpectEqual( '', 0 );
		this.assertTrue( ! expect.evaluate(), 'null to char' );
	
		var expect = new ExpectEqual( 0, '' );
		this.assertTrue( ! expect.evaluate(), 'char to null' );
	}
}





function ExpectTrueTest() {
	ExpectTrueTest.prototype = new TestCase();
	TestCase.call( this, 'ExpectTrueTest' );
}


this.test_evaluateReturnsTrueIfActualIsTrue = function() {
	var expect = new ExpectTrue( true );
	this.assertTrue( expect.evaluate() );
}

this.test_evaluateReturnsFalseIfActualIsFalse = function() {
	var expect = new ExpectTrue( false );
	this.assertTrue( ! expect.evaluate() );
}

this.test_evaluateDoesNotCastTheActualIntoBooleanAndSoReturnsFalseForEverythingExceptTrue = function() {
	var expect = new ExpectTrue( 1 );
	this.assertTrue( ! expect.evaluate(), '1' );

	var expect = new ExpectTrue( 'true' );
	this.assertTrue( ! expect.evaluate(), 'true' );

	var expect = new ExpectTrue( '1' );
	this.assertTrue( ! expect.evaluate(), '(string)1' );

}
